<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>成绩修改审核</el-breadcrumb-item>
    </el-breadcrumb>
    <el-table size="small" :data="gradeList" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
      <!-- <el-table-column align="center" type="selection" width="60">
      </el-table-column> -->
      <el-table-column align="center" prop="studentName" label="学生姓名" width="200">
      </el-table-column>
      <el-table-column align="center" prop="courseName" label="课程名" width="200">
      </el-table-column>
      <el-table-column align="center" prop="scores" label="修改后成绩（分）" width="200">
        <template slot-scope="scope">
          {{(scope.row.scores * 100) | 0}}
        </template>
      </el-table-column>
      <el-table-column align="center" label="操作" min-width="200">
        <template slot-scope="scope">
          <el-button type="primary" size="mini" @click="checkRecord(scope.row.id, 1)">通过</el-button>
        <el-button type="warning" size="mini" @click="checkRecord(scope.row.id, 0)">拒绝</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <Pagination v-bind:child-msg="pageQuery" :total="total" @callFather="callFather"></Pagination>
  </div>
</template>

<script>
import { mapState } from 'vuex'
import Pagination from '../../components/Pagination'
export default {
  name:'UserDetail',
  data() {
    return {
      gradeList: [], // 未审核列表
      pageQuery: {
        pageNum: 1,
        pageSize: 10
      },
      total: 0,
      loading: false, //是显示加载
    }
  },
  // 注册组件
  components: {
    Pagination
  },
  created() {
      this.noCheckList()
  },
  computed: {
    ...mapState(['user'])
  },
  methods: {
      /**
       * 审核请求
       */
    checkRecord (id, type) {
        let params = {
            changeId: id,
            sign: type
        }
        this.$api.course.checkRecord(params).then(res => {
            if (res.code === 200) {
                this.noCheckList()
            }
        })
    },
    /**
     * 查询指定教师的授课安排
     */
    noCheckList () {
        this.loading = true
      this.$api.course.noCheckList(this.pageQuery).then(res => {
        if (res.code === 200) {
          this.gradeList = res.data.records
          this.total = res.data.total
          this.loading = false
        }
      }).catch(err => this.loading = false)
    },
    
    /**
     * 分页插件事件
     */
    callFather(parm) {
      this.pageQuery.pageNum = parm.currentPage
      this.pageQuery.pageSize = parm.pageSize
      this.noCheckList()
    }
  }
}
</script>

<style>
.user-search {
  margin-top: 20px;
}
.userRole {
  width: 100%;
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409EFF;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>

 
 